package com.onstar.cn.api;

import com.onstar.cn.api.framework.BaseApiService;
import com.onstar.cn.api.framework.ClazzInjectUtils;
import com.onstar.cn.api.framework.annotation.Path;
import com.onstar.cn.api.framework.annotation.PathParams;
import com.onstar.cn.api.framework.annotation.RequestMapping;
import com.onstar.cn.framework.network.entity.RequestEntity;

/**
 * Created by Yonglang Hong on 2016/8/23.
 */
@Path("/resources/v1/user")
public class FootPrintService extends BaseApiService{

    private String serverURL;

    public FootPrintService(String serverUrl) {
        super(serverUrl);
        this.serverURL = serverUrl;
    }

    /**
     * 概览模式下分享接口
     * @return
     */
    @RequestMapping("/subscriber/{idpUserID}/accounts/{accountID}/vehicles/{vin}/services/footprint/summary?longitude={longitude}&latitude={latitude}")
    public RequestEntity getShareUrlOfOverView(RequestEntity requestEntity,
                                               @PathParams(value = "idpUserID") String idpUserID,
                                               @PathParams(value = "accountID") String accountID,
                                               @PathParams(value = "vin") String vin,
                                               @PathParams(value = "longitude") String longitude,
                                               @PathParams(value = "latitude") String latitude) {
        if (requestEntity == null)
            requestEntity = new RequestEntity();
        String url = ClazzInjectUtils.injectUrl(getClass(),
                "getShareUrlOfOverView",
                requestEntity,
                idpUserID,
                accountID,
                vin,
                longitude,
                latitude);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

    /**
     * 详情模式下分享接口
     * @return
     */
    @RequestMapping("/subscriber/{idpUserID}/accounts/{accountID}/vehicles/{vin}/services/footprint/city?longitude={longitude}&latitude={latitude}&city={city}&scale={scale}")
    public RequestEntity getShareUrlOfDetail(RequestEntity requestEntity,
                                             @PathParams(value = "idpUserID") String idpUserID,
                                             @PathParams(value = "accountID") String accountID,
                                             @PathParams(value = "vin") String vin,
                                             @PathParams(value = "longitude") String longitude,
                                             @PathParams(value = "latitude") String latitude,
                                             @PathParams(value = "city") String city,
                                             @PathParams(value = "scale") String scale) {
        if (requestEntity == null) {
            requestEntity = new RequestEntity();
        }
        String url = ClazzInjectUtils.injectUrl(getClass(),
                "getShareUrlOfDetail",
                requestEntity,
                idpUserID,
                accountID,
                vin,
                longitude,
                latitude,
                city,
                scale);
        requestEntity.setUrl(serverURL + url);
        return requestEntity;
    }

}
